<?php
/*
//传统写法，分别new一个对象，因为Canvas类比较大，初始化要循环200次，比较消耗资源
spl_autoload_register();

$canvas1 = new vendor\Canvas();
$canvas1->init();
$canvas1->rect(3,6,4,12);
$canvas1->draw();

echo '<hr />';

$canvas2 = new vendor\Canvas();
$canvas2->init();
$canvas2->rect(1,3,2,6);
$canvas2->draw();
*/

spl_autoload_register();
$prototype = new \vendor\Canvas();
$prototype->init();


$canvas1 = clone $prototype;
$canvas1->rect(3,6,4,12);
$canvas1->draw();

echo '<hr />';

$canvas2 = clone $prototype;
$canvas2->rect(3,3,1,12);
$canvas2->draw();